package com.qudian.java.core.utils;

import java.io.InputStream;
import java.util.Properties;

public final class Env extends Properties {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private static Env instance;
	
	private Env() throws Exception {
		InputStream is = getClass().getResourceAsStream("/config.properties");
		if (is==null) {
			throw new Exception("config.properties Not found");
		}
		try {
			load(is);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public static Env getInstance() throws Exception {
		if (instance != null)
			return instance;
		else {
			makeInstance();
			return instance;
		}
	}

	private static synchronized void makeInstance() throws Exception {
		if (instance == null)
			instance = new Env();
	}


	

}
